<?php
/**
 * 详情
 * Enter description here ...
 * @author nijn
 *
 */
class ViewAction extends CAction{
	public $modelName = '';
	public $view = 'view';
	public $data = array();
	public $criteria = array();
	public function run(){
		$c = $this->controller;
		$modelName = empty($this->modelName) ? $c->modelName : $this->modelName;
		$model = new $modelName();
		$criteria = $model->getDbCriteria();
		$criteria->mergeWith(new CDbCriteria($this->criteria));
		$model = $model->findByPk(isset($_GET['id']) ? $_GET['id'] : 0,$criteria);
	
		if (!is_object($model)) $c->redirect(Yii::app()->createUrl('misc/error404',array('msg'=>'该数据不存在')));
		
		$c->render($this->view, array_merge($this->data,array(
			'model' => $model,
		)));
	}
}

?>